/* eslint valid-jsdoc: "off" */

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1727084685855_6805';

  // add your middleware config here
  config.middleware = [];
  config.wechatConfig = {
    token: '123456',
    appId: "wx510e698c9a72488e",
    appSecret: "e49d228b53e8380a925b3ab7a7071460",
    redirectUri: "https://361069y1s7.picp.vip"
  };
  config.multipart = {
    mode: 'file',
    fileSize: '5mb',
    fileExtensions: ['.xlsx'],
  };
  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
    // 数据库连接
    mysql: {
      // 单数据库信息配置
      client: {
        // host
        host: 'localhost',
        // 端口号
        port: '3306',
        // 用户名
        user: 'root',
        // 密码
        password: '123456',
        // 数据库名
        database: 'pos',
      },
      // 是否加载到 app 上，默认开启
      app: true,
      // 是否加载到 agent 上，默认关闭
      agent: false,
    },
  };
  config.jwt = {
    secret: 'hywl-666' //自定义 token 的加密条件字符串 
  }
  config.cors = {
    origin: '*', // 允许特定的域名进行跨域请求
    allowMethods: 'GET,POST,PUT,DELETE,PATCH', // 允许的方法
    credentials: true, // 是否允许发送Cookie
  };

  // config.middleware = ['checktoken'];
  config.security = {
    csrf: {
      enable: false
    }
  }
  return {
    ...config,
    ...userConfig,

  };
};

